﻿using Apex.Commons.ServiceRegistrationCenter;
using Microsoft.Extensions.DependencyInjection;
using Quartz.Spi;
using TaskMasterByQuartz.Domain.Helper;
using TaskMasterByQuartz.Domain.InterfaceRepository;
using TaskMasterByQuartz.Domain.ServiceRepository;
using TaskMasterByQuartz.Infrastructure.Implementations;
using TaskMasterByQuartz.Infrastructure.Initializer;

namespace IdentityService.Infrastructure.Initializer
{
    class ModuleInitializer : IModuleInitializer
    {
        public void Initialize(IServiceCollection services)
        {
            services.AddScoped<SchedulerDomainService>();
            services.AddScoped<CreateTriggerHelper>();
            services.AddScoped<ISchedulerCenter, SchedulerCenter>();
            services.AddScoped<HttpHelper>();

            services.AddScoped<ICustomJobLog, CustomJobLog>();
            services.AddSingleton<IJobFactory, JobFactory>();
            services.AddSingleton<MyHttpJob>();
            // https://learn.microsoft.com/zh-cn/aspnet/core/fundamentals/http-requests?view=aspnetcore-8.0
            services.AddHttpClient();
        }
    }
}